begintalkscript;

variables;
short leadchar,bmessage;
string custom_m;

begintalknode 1;
	state = -1;
	nextstate = 1;
	question = "Mysterious Figure";
	text1 = "The mysterious figure is waiting patiently.";
	text2 = "_K_ is waiting patiently.";
	code = 
		if(get_flag(24,1) == 1)
			remove_string(1);
		else
			remove_string(2);
break;

begintalknode 2;
	state = 1;
	nextstate = -1;
	condition = get_flag(24,1) == 0;
	question = "Who are you?";
	text1 = "_I will not tell you all of the information you are likely looking for immediately.  Time will tell if you are worthy of any more than this._";
	text2 = "_I am a spellcaster of great skill.  I hold a valuable position in the Imperial government.  I am a friend and ally to you, and I wish to help you defeat the brigands._";
	text3 = "_For now, you may refer to me as _K_ for sake of convenience._";
	code = 
		set_flag(24,1,1);
		set_name(6,"'K'");
break;

begintalknode 3;
	state = 1;
	nextstate = -1;
	condition = (get_flag(24,1) >= 1) && (get_flag(5,0) == 1);
	question = "You're the one who was sending letters to Gen. Abidan!";
	text1 = "'K' looks up in what appears to be surprise.  _You're better informed than I had thought.  Yes, I was the one who had sent letters to Abidan._";
	text2 = "_I thought he would be able to act in your stead and kill off the brigands.  Unfortunately, it seems as if someone had already pre-empted this and had him assassinated._";
	text3 = "_It's unfortunate.  He was a good man.  And right after his son, a worthy inheritor of his name, was reported dead due to a case of massive bureaucratic incompetence._";
	code = 
		set_flag(5,0,2);
break;

begintalknode 4;
	state = 1;
	nextstate = -1;
	condition = (get_flag(71,0) == 0) && (party_size() == 1);
	question = "How do you know who I am?";
	text1 = "He shakes his head.  _Don't get the wrong idea.  I was merely looking for any competent adventurers to come to my aid, not you in particular.  But when I saw that you were approaching, I decided to at least learn your name and reputation._";
	text2 = "_I'm no predator.  I only know of you because you chose to make yourself visible to me._";
	code = 
		set_flag(71,0,1);
break;

begintalknode 5;
	state = 1;
	nextstate = -1;
	condition = (get_flag(71,0) == 0) && (party_size() > 1);
	question = "How do you know who we are?";
	text1 = "He shakes his head.  _Don't get the wrong idea.  I was merely looking for any competent adventurers to come to my aid, not you in particular.  But when I saw that you were approaching, I decided to at least learn your names and reputations._";
	text2 = "_I'm no predator.  I only know of you because you chose to make yourselves visible to me._";
	code = 
		set_flag(71,0,1);
break;

begintalknode 6;
	state = 1;
	nextstate = -1;
	condition = (party_size() == 1) && (get_flag(65,0) == 0);
	question = "Why am I here?";
	text1 = "_Well, as I told you before, I wanted Abidan here to fight for me, but given the circumstances, that quickly became impossible.  And so, I sent for you._";
	text2 = "_General Abidan, whose ruined manor I'm certain you passed on your way here, was who I wanted to do your job.  Unfortunately, the brigands had him assassinated._";
	text3 = "_What I want you to do is to fight against the brigands.  What this means in practice, though, is less than merely clearing out this valley._";
	text4 = "_These brigands are better-equipped than most, I'm certain you know that.  Just how deep this conspiracy goes, however, is astounding.  These brigands are more than you may be bargaining on, even given how much power they command._";
	code = 
		if(get_flag(5,0) == 2){
			remove_string(2);
		}
		else{
			remove_string(1);
		}
		set_flag(65,0,1);
break;

begintalknode 7;
	state = 1;
	nextstate = -1;
	condition = (party_size() > 1) && (get_flag(65,0) == 0);
	question = "Why are we here?";
	text1 = "_Well, as I told you before, I wanted Abidan here to fight for me, but given the circumstances, that quickly became impossible.  And so, I sent for you._";
	text2 = "_General Abidan, whose ruined manor I'm certain you passed on your way here, was who I wanted to do your job.  Unfortunately, the brigands had him assassinated._";
	text3 = "_What I want you to do is to fight against the brigands.  What this means in practice, though, is less than merely clearing out this valley._";
	text4 = "_These brigands are better-equipped than most, I'm certain you know that.  Just how deep this conspiracy goes, however, is astounding.  These brigands are more than you may be bargaining on, even given how much power they command._";
	code = 
		if(get_flag(5,0) == 2){
			remove_string(2);
		}
		else{
			remove_string(1);
		}
		set_flag(65,0,1);
break;

begintalknode 8;
	state = 1;
	nextstate = -1;
	condition = get_flag(66,0) == 0;
	question = "What is 'here'?";
	text1 = "_A very astute question.  Here is, how to put it...  A very sequestered place.  I call it 'Sanctuary', since nobody without permission may enter this place._";
	text2 = "_It's as far away from Sunset Creek as you can imagine, and yet, as you saw just now, here can be visited from there at any time._";
	text3 = "_I don't expect you to understand the specifics.  Heck, sometimes I hardly understand them myself.  Still, here is a safe place to be, if not difficult to reach at times._";
	code = 
		set_flag(66,0,1);
break;

begintalknode 9;
	state = 1;
	nextstate = -1;
	condition = get_flag(65,0) == 1;
	question = "Why can't you kill a few brigands yourself?";
	text1 = "_I can.  But...  to do that, there are some things that I risk._";
	text2 = "_The main base of operations for these brigands is conveniently located near...  a large nexus of power.  Now, this 'nexus' does not prevent me from destroying the brigands and whomever it is that leads them..._";
	text3 = "_On the other hand, what could happen if I use my full power close enough to that 'nexus' is not worth it.  I will spare you the details, but suffice it to say that these brigands are nowhere near as bad as...  other things._";
	text4 = "_You, on the other hand, have comparatively little power.  Thus, my plan is to use you to assassinate the leader of these brigands in a surgical strike.  If I'm right, then these brigands and their resources are flowing from the top down._";
	code = 
		set_flag(65,0,2);
break;

begintalknode 10;
	state = 1;
	nextstate = -1;
	condition = (get_flag(5,0) >= 1) && (get_flag(65,0) == 2);
	question = "Is it true that a 'rakshasa' leads these brigands?";
	text1 = "_So!  You read the letter I had sent to General Abidan.  Yes, that is precisely what I fear.  The magically-powered watercraft you see these brigands using are not fueled by Imperial magical techniques._";
	text2 = "_In fact, the 'nexus' is...  shall we say, rakshasic in origin.  I suspect that the brigand outpost is strategically placed.  I do not know WHY it is, and fortunately the brigands do not seem to have interacted with it significantly._";
	text3 = "_Furthermore, this otherwise-inexplicable brigand attack coincides too conveniently with the recent nephilim uprising in the Ivalice Province, which was caused by a rakshasa as well._";
	text4 = "_I suspect that these actions coincide with a greater plan, though I do not currently know what it is._";
	code = 
		if(get_flag(5,0) == 1)
			set_flag(5,0,2);
		set_flag(65,0,3);
break;

begintalknode 11;
	state = 1;
	nextstate = -1;
	condition = (get_flag(5,0) == 0) && (get_flag(65,0) == 2);
	question = "Who leads these brigands?";
	text1 = "_A rakshasa:  That is, a magically-imbued tiger humanoid of great power.  I do not know for sure of this, but the magically-powered watercraft you see these brigands using are not fueled by Imperial magical techniques._";
	text2 = "_In fact, the 'nexus' is...  shall we say, rakshasic in origin.  I suspect that the brigand outpost is strategically placed.  I do not know WHY it is, and fortunately the brigands do not seem to have interacted with it significantly._";
	text3 = "_Furthermore, this otherwise-inexplicable brigand attack coincides too conveniently with the recent nephilim uprising in the Ivalice Province, which as you know was caused by a rakshasa as well._";
	text4 = "_I suspect that these actions coincide with a greater plan, though I do not currently know what it is._";
	code = 
		set_flag(5,0,2);
		set_flag(65,0,3);
break;

begintalknode 12;
	state = 1;
	nextstate = -1;
	condition = get_flag(65,0) == 3;
	question = "How are the brigands to be defeated?";
	text1 = "_Their lair will almost never be found by any cursory inspection of the landscape here.  It's underground._";
	text2 = "_To get there, you will have to be able to drop two kilometers down.  Fortunately, the brigands have created an elastic barrier that can be used to both launch objects towards the surface and receive objects from the surface._";
	text3 = "_The barrier is magical, however, and only responds when used by someone bearing a special emblem.  Fortunately, this emblem is fairly easy to reproduce, and I have already done so._";
	text4 = "_There is a chest you will find in the room to the west of the fountain to my south.  Take what you find inside._";
	code = 
		set_flag(65,0,4);
		set_terrain(8,22,203);
break;

begintalknode 13;
	state = 1;
	nextstate = -1;
	condition = get_flag(65,0) == 4;
	question = "Where is this 'elastic barrier'?";
	text1 = "_No, no.  First, go get the emblem I told you about.  Don't worry, we're not in any hurry yet._";
	action = END_TALK;

begintalknode 14;
	state = 1;
	nextstate = -1;
	condition = get_flag(65,0) == 5;
	question = "What now?";
	text1 = "_Come closer.  I will give you yet another boon._";
	action = END_TALK;

begintalknode 15;
	state = 1;
	nextstate = -1;
	condition = get_flag(65,0) == 6;
	question = "What now?";
	text1 = "_Now, you go back.  Go east from the portal on the platform as far as you can, and you'll hit the mountain wall.  Take it to the north and you'll practically run into a hidden passageway.  It's tough to find if you're not looking for it, though._";
	text2 = "_Anyway, just step back onto the glyphs in the room to my right, and you'll be back on the other side of the portal._";
	text3 = "_I've set up some spellbooks past the fountain to the south if you haven't found them already-- make sure to read them; their contents will help you._";
	text4 = "_You can take a rest if you want, and I've put some food in the kitchen if you'll be wanting any.  Leave whenever you're ready._";
	code = 
		set_flag(65,0,7);
		put_item_on_spot(20,9,4);
		put_item_on_spot(21,9,4);
		put_item_on_spot(23,9,4);
		put_item_on_spot(22,9,7);
break;

begintalknode 16;
	state = 1;
	nextstate = -1;
	condition = get_flag(65,0) == 7;
	question = "Will you be of any help later on?";
	text1 = "_Yes, yes.  Don't worry, I'm prepared to give you more advice the further you go._";

begintalknode 17;
	state = 1;
	nextstate = -1;
	condition = get_flag(65,0) == 7;
	question = "Where did the brigands come from?";
	text1 = "...";
	text2 = "_I don't know.  Sorry._";

begintalknode 20;
	state = -1;
	nextstate = 2;
	question = "Hunter";
	text1 = "This woman is lying half-asleep on the bed here.  She doesn't even bother turning my way.  She still appears to be hurting pretty badly.";
	text2 = "This woman is lying half-asleep on the bed here.  She doesn't even bother turning our way.  She still appears to be hurting pretty badly.";
	code = 
		if(party_size() == 1)
			remove_string(2);
		else
			remove_string(1);
break;

begintalknode 21;
	state = 2;
	nextstate = -1;
	condition = get_flag(72,0) == 0;
	question = "Who are you?";
	text1 = "_...you're not going to just walk away, are you?  Fine.  I'm Hunter._";
	text2 = "That name.  It sounds familiar.";
	code = 
		set_flag(72,0,1);
break;

begintalknode 22;
	state = 2;
	nextstate = -1;
	condition = get_flag(72,0) == 1;
	question = "Hunter...  Wait a second!";
	text1 = "_Yeah, yeah.  I'm THAT Hunter.  Damn, now I regret telling you._";
	text2 = "Wow!  It's the woman who singlehandedly put down the Ratbane Revival in Ivalice Province!  She's become a legend throughout all of Valorim, and has supposedly earned the admiration of many high-ranking politicians in the capitol.";
	text3 = "But then...  what is she doing here?  And why does she look so maimed?";
	code = 
		set_flag(72,0,2);
break;

begintalknode 23;
	state = 2;
	nextstate = -1;
	condition = get_flag(72,0) == 2;
	question = "What are you doing here?";
	text1 = "_Bleeding.  And wondering._";
	text2 = "That doesn't exactly answer the question, but...";
	code = 
		set_flag(72,0,3);
break;

begintalknode 24;
	state = 2;
	nextstate = -1;
	condition = get_flag(72,0) == 3;
	question = "What are you wondering about?";
	text1 = "_Footracer...  He's dead.  I killed him._";
	text2 = "What?  She's mistaken.  General Footracer was executed by military tribunal on Emperor Stewart I's orders.";
	code = 
		set_flag(72,0,4);
break;

begintalknode 25;
	state = 2;
	nextstate = -1;
	condition = get_flag(72,0) == 4;
	question = "General Footracer was executed years ago.";
	text1 = "She laughs for a few seconds, then begins hacking.  _Yeah...  Yeah, yeah.  I know that's what you think, but it's wrong.  He was alive and well.  At least, until I killed him._";
	text2 = "_Listen, I got tons of shockers I've been learning these last few weeks, and the hole only grows deeper the more I poke at it._";
	text3 = "_Did you know, for instance, that General Footracer was behind the Ratbane Revival?_";
	text4 = "She has to be crazy.";
	code = 
		set_flag(72,0,5);
break;

begintalknode 26;
	state = 2;
	nextstate = -1;
	condition = get_flag(72,0) == 5;
	question = "You're mad.  The general would never do that.";
	text1 = "_There were enough troops in Kalzas to have nipped that whole rebellion in the bud.  Reports show that Duke Eubans was not only aware of but responsible for the nephilim to congregate at Ivalice._";
	text2 = "_And Eubans?  Just an alter-ego of Footracer himself, using his connections with Stewart to put him in a position of power.  Consider:  General Footracer was declared deceased shortly after the Duke went 'missing'._";
	code = 
		set_flag(72,0,6);
break;

begintalknode 27;
	state = 2;
	nextstate = -1;
	condition = get_flag(72,0) == 6;
	question = "But isn't some 'rakshasa' responsible for Ivalice?";
	text1 = "Her face twists into a scowl and she spits a globule of saliva with flecks of blood in it at the floor.  _Yes!  His name is Sabertooth, damn him to hell!_";
	text2 = "_Yes, Sabertooth the rakshasa was responsible for what went on in Ivalice.  But I thought Footracer was attempting to garner more troops as Duke Eubans.  I thought he and Sabertooth were working together._";
	text3 = "_As it turns out, I wasn't wrong either, but this conspiracy goes even deeper than that._";
	code = 
		set_flag(72,0,7);
break;

begintalknode 28;
	state = 2;
	nextstate = -1;
	condition = get_flag(72,0) == 7;
	question = "Howso?";
	text1 = "_Well, the original tactic of the Ratbane Revival was to scare Stewart I and then-General Field Marshall Abidan into putting more troops under Footracer's direct control._";
	text2 = "_But if I killed Footracer, then the next move Sabertooth would make wouldn't be so intensely similar to the Ratbane Revival in form._";
	text3 = "_The answer is, there's a mole in the Empire.  Someone who is either a rakshasa or has connections to a rakshasa has to be vying for power here._";
	text4 = "_At least, that explains why Abidan is...  dead._";
	code = 
		set_flag(72,0,8);
break;

begintalknode 29;
	state = 2;
	nextstate = -1;
	condition = get_flag(72,0) == 8;
	question = "Whom do you suspect is the 'mole'?";
	text1 = "_I have my eyes on a few of the higher-up Generals.  After all, it was an Imperial Assassin who, without proper jurisdiction, attacked me._";
	text2 = "_At least, none of the politicians in this backwater nowhere stand to gain anything by having more troops assigned here.  None of them have the authority to command such a large number of troops._";

begintalknode 30;
	state = 2;
	nextstate = -1;
	condition = get_flag(72,0) == 8;
	question = "What about Abidan?";
	text1 = "_He...  He used to be General Field Marshall, but he had been growing distant from Imperial politics for some time.  He was not going to authorize any grandiose plans or large rearrangements of troops without...  a prompt._";
	text2 = "_His son, he..._";
	text3 = "She pauses, then turns over.  _Go away._";
	action = END_TALK;

